﻿namespace VividKit.ComponentModel
{
    using System;
    using VividKit.PresentationModel.Navigation;

    public class DesktopServiceProvider : ServiceProviderBase
    {
        private readonly ICommandManager commandManager;
        private readonly IDispatcher dispatcher;

        public DesktopServiceProvider()
        {
            this.dispatcher = new Dispatcher();
            this.commandManager = new CommandManager();
        }

        protected override object GetServiceOverride(Type serviceType)
        {
            if (serviceType == typeof(IDispatcher))
            {
                return this.dispatcher;
            }
            if (serviceType == typeof(ICommandManager))
            {
                return this.commandManager;
            }
            if (serviceType == typeof(INavigationService))
            {
                return NavigatorService.NavigationService;
            }

            return null;
        }
    }
}